<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <!--<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">-->
    <link rel="stylesheet" href="/elementui/index.css">
    <style>
        .box-card{
            margin:200px auto;
            width: 480px;
        }
        .clearfix{
            text-align: center;
            color:#303133;
            font-size: 18px;
        }
        .login-form{
            width: 400px;
        }
    </style>
</head>
<body>
<div id="app">
    <el-card class="box-card">
        <div slot="header" class="clearfix">
            <span>系统登录</span>
        </div>
       <el-form class="login-form" ref="form"  :model="form" label-width="80px">
            <el-form-item label="账号">
           <el-input v-model="form.username"></el-input>
           </el-form-item>
           <el-form-item label="密码">
               <el-input type="password" v-model="form.password"></el-input>
           </el-form-item>
           <el-form-item >
               <el-checkbox v-model="form.rememberMe">记住我</el-checkbox>
           </el-form-item>
           <el-form-item>
               <el-button type="primary" @click="login">登 录</el-button>
               <el-button>取 消</el-button>
           </el-form-item>
        </el-form>
    </el-card>
</div>
<script src="/vue/vue.js"></script>
<script src="/elementui/index.js"></script>
<script src="/axios/axios.min.js"></script>
<script src="/qs/qs.min.js"></script>
<script>
    new Vue({
       el:"#app",
        data:{
           form:{username:"",password:"",rememberMe:false}
        },
        methods:{
           login:function () {
               //Qs.stringify(this.form) 将form由{xx:值} 转为 xx=值&xx=值
               axios.post("/user/login",Qs.stringify(this.form))
                   .then(res=>{
                      if(res.data.code == 1){
                          location.href = "/pages/index.html";
                      }
                   });
           }
        }
    });
</script>
</body>
</html>